package tas.co.in.controller.complainController;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.multiaction.MultiActionController;

import tas.co.in.dao.complainController.complainConnect;
import tas.co.in.domain.complainController.complainBean;

public class complain extends MultiActionController 
{

	private complainConnect connectCompain;
	
	/**
	 * @param connectCompain the connectCompain to set
	 */
	public void setConnectCompain(complainConnect connectCompain) {
		this.connectCompain = connectCompain;
	}

	public ModelAndView createComplain(HttpServletRequest request,
			HttpServletResponse response)
	{
		complainBean beanComp=new complainBean();
		beanComp.setPhone_number(request.getParameter("phone_number"));
		beanComp.setNarration(request.getParameter("narration"));
		beanComp.setRef_request_no(request.getParameter("ref_request_no"));
		beanComp.setCustomer_id(request.getParameter("customer_id"));
		beanComp.setDate(request.getParameter("date"));
		beanComp.setCreation_time(request.getParameter("creation_time"));
		
		
		
		complainBean resultList =connectCompain.createRequest(beanComp);
		
		System.out.println(resultList.getResult());
		
		return new ModelAndView("sharedJSP/complainResult", "resultObject",
				resultList.getResult()) ;
		
	}
	
	
	public ModelAndView viewAllComplains(HttpServletRequest request,
			HttpServletResponse response)
	{
		complainBean beanComp=new complainBean();
		beanComp.setPhone_number(request.getParameter("phone_number"));
		
		List<complainBean> resultList =connectCompain.viewAllComplains(beanComp);		
		return new ModelAndView("sharedJSP/AllcomplainResult", "resultList",
				resultList);
		
	}
	
	
	
	
}
